Create a new (auto-restarting) service definition
cd ~/.config/systemd/user
vi test.service
[Unit]
Description=test
[Service]
ExecStart=/usr/bin/python3 /path/to/service.py
Restart=on-failure
[Install]
WantedBy=default.target
Reload systemd services so the new service is picked up
systemctl --user daemon-reload
Check the service exists
systemctl --user list-unit-files
systemctl --user start service
systemctl --user stop service
This service can be persisted on boot by:
systemctl enable --user service